package com.sealer.pattern.structural.flyweight;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by sealer on 17/04/04.
 */
public class CoffeeShop {
    private final Menu menu = new Menu();
    private final List<Order> orders = new ArrayList<>();

    public void takeOrder(String flavor, int tableNum) {
        CoffeeFlavor coffeeFlavor = menu.lookup(flavor);
        Order order = new Order(new CoffeeFlavor(flavor), tableNum);
        orders.add(order);
    }

    public void serve() {
        for (Order order : orders)
            order.serve();
    }

    public String report() {
        return "\ntotal CoffeeFlavour objects made: "
                + menu.totalCoffeeFlavoursMade();
    }
}
